UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UdvLkxW101WSb4LMebx/B+NyAsOcI5D+WYDvs3c/Oac=' 
WHERE 
  key_id = '7598cf716c7acd68009d9582352bb9c10189109af90bbfd9404ec6ad3d9121ec' 
  AND (
    token = 'UdvLkxW101WSb4LMebx/B+NyAsOcI5D+WYDvs3c/Oac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028