UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wEeWfxn2ke0FNZ1A08EiXuGoH0Nxc4ikuo5ilXs91OQ=' 
WHERE 
  key_id = '9ae7b4674f2d7ab9d4ad149579cec80ad51df5259e3728a53a5498ccb16aa9a1' 
  AND (
    token = 'wEeWfxn2ke0FNZ1A08EiXuGoH0Nxc4ikuo5ilXs91OQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025