UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qtdZ7NYOIB5XrxXl7Q8nlBYgojU4g+MAdWyp0tSjTAI=' 
WHERE 
  key_id = 'd76e3ebed401a3a1b5084f23a92a508a9959c8deeea578dddcd341df4a04520f' 
  AND (
    token = 'qtdZ7NYOIB5XrxXl7Q8nlBYgojU4g+MAdWyp0tSjTAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052