UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pFrrLvmhdHnVjHb4Z8rFekqeL2vABkX3A5j6teZGPu4=' 
WHERE 
  key_id = '563dd9011193075c783be77684331319a9f4a601b329dc7b3efdbebd6d7a3dae' 
  AND (
    token = 'pFrrLvmhdHnVjHb4Z8rFekqeL2vABkX3A5j6teZGPu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040