UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w9M0kGOH3DRO33g8twuMaLDDb+1ZhCiGS7qhXJtA7JA='
WHERE
key_id = 'edfd167913aa51cd871c6ee8dc5476948b527f95df6182d445736fc54d4d875b'
AND (
token = 'w9M0kGOH3DRO33g8twuMaLDDb+1ZhCiGS7qhXJtA7JA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)