UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2qoFVgd8YS37ANF3Zosk9A0RFZa3mSTvIJ1Qo23r0m8=' 
WHERE 
  key_id = '90621c2766de86594fadde659e949231623d5edcbb124423cfd429ea040a31da' 
  AND (
    token = '2qoFVgd8YS37ANF3Zosk9A0RFZa3mSTvIJ1Qo23r0m8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037