UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5kTK6dd4ROCShFegADSwoq40GyUNMm/2c29QKocY2w=' 
WHERE 
  key_id = 'de66e30c0e99e6c82058eeca3db6e7b8b494b3f24aae41fe7d050dbe556300f7' 
  AND (
    token = 'c5kTK6dd4ROCShFegADSwoq40GyUNMm/2c29QKocY2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026