UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aEw+L/euV+53shc/kBYBNBjsoHn1mLpVsM5QPXYnz+0=' 
WHERE 
  key_id = '0a9135c06f0dd7492aacc1668a78d52c85b2a6949e3dbabca8895097435c3a51' 
  AND (
    token = 'aEw+L/euV+53shc/kBYBNBjsoHn1mLpVsM5QPXYnz+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044