UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HzGSoO5Tl6wvoNJGpOS+T9lpqV1OPLM6KvpjpXPnMu4=' 
WHERE 
  key_id = 'ff8da3e96c1141482f8a0bffea783f350753196732607f3133a30acb0cb9364c' 
  AND (
    token = 'HzGSoO5Tl6wvoNJGpOS+T9lpqV1OPLM6KvpjpXPnMu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050