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