UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '42EwWyp0Hxn+tYsFkrEsUznzagSWvMlveYmIM0W63PE=' 
WHERE 
  key_id = 'fb5a0ce52cd0ff526621531ca69e6050a8ca401896c3a09914830f732e4d404e' 
  AND (
    token = '42EwWyp0Hxn+tYsFkrEsUznzagSWvMlveYmIM0W63PE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026