UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M1LyGxoPIUT+ocREWvfdxAAGnMRcrcBcvi+tluLstkU=' 
WHERE 
  key_id = '825ad21fe741966749cadbecfc2dfae90696820595ed7c98cbd75527cf52a11e' 
  AND (
    token = 'M1LyGxoPIUT+ocREWvfdxAAGnMRcrcBcvi+tluLstkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045