UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TcrLGZ3JTyvyv7xY4L1RUQVBl2W2Zd0wHFAQataHq1U=' 
WHERE 
  key_id = '82bd59b7b11204816ce650b8841d3d9209b73bce14e500f71ed948bd9df0145e' 
  AND (
    token = 'TcrLGZ3JTyvyv7xY4L1RUQVBl2W2Zd0wHFAQataHq1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043