UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'du/3Cou7PF294ymQPKkfVYPXJz/HjtUUGDHYDDToxeY=' 
WHERE 
  key_id = 'bbb38544c307b5390240361141eea845ee2edc48d1a080778f79918641835547' 
  AND (
    token = 'du/3Cou7PF294ymQPKkfVYPXJz/HjtUUGDHYDDToxeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033