UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3LZfdheaGx9aljMfzm0OxjiKicnbg/LGF6P3TUylAZI=' 
WHERE 
  key_id = '41f974fd8fa2673c1c336b9eed27cd7106ee17bd885441cadc5d80797b3daa54' 
  AND (
    token = '3LZfdheaGx9aljMfzm0OxjiKicnbg/LGF6P3TUylAZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021