UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sk2fYvG9u5SiukJP9/EH7oHeW0//m4naS1Yh5AwdtYk=' 
WHERE 
  key_id = '818ae10d583988768e1d456009d2b0a50834be42822cd29379fc5abafedcc2f1' 
  AND (
    token = 'sk2fYvG9u5SiukJP9/EH7oHeW0//m4naS1Yh5AwdtYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052