UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UhSz03vmEke8HZgwwfEZrobhpOO6wpPf8jpXh40oeYg='
WHERE
key_id = '52e997ba0189b893aaeed789e823643bc25473cbddcf5785672262929978ed85'
AND (
token = 'UhSz03vmEke8HZgwwfEZrobhpOO6wpPf8jpXh40oeYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)