UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IoNJI9I3vgrKG0cy60OSN3X6cozhgrYbcV4y0ChsNko=' 
WHERE 
  key_id = 'a9a66aadb436ea827344e8f5bcce379567db7c9f9fa359d87940d10c543855fa' 
  AND (
    token = 'IoNJI9I3vgrKG0cy60OSN3X6cozhgrYbcV4y0ChsNko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036