UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'haBeZHrLTTm5IT1jdqTxEv2Fhi6OQiegFMNY8rNE/mE=' 
WHERE 
  key_id = '175528246b3af47863d0e21ad12240d8a2854e249ef69d8f599aba00dff31b95' 
  AND (
    token = 'haBeZHrLTTm5IT1jdqTxEv2Fhi6OQiegFMNY8rNE/mE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026