UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eZb1gC2EJJoIwe9uHKkczBMnNAs4qfd4x/6pG4KbVzQ=' 
WHERE 
  key_id = '4877fe69727534bd2d88c8b95c5afca8ee1a5e146918cd18d1381184baaeff7b' 
  AND (
    token = 'eZb1gC2EJJoIwe9uHKkczBMnNAs4qfd4x/6pG4KbVzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038