UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4qBf9a8KDczwMVWc4B+DwVU8Gyp4gofy0w8LNKNN0G0='
WHERE
key_id = 'caadb4fa4133152bd1f41df1203911752c4240a0ab49c39f452a8cdf44b0cecb'
AND (
token = '4qBf9a8KDczwMVWc4B+DwVU8Gyp4gofy0w8LNKNN0G0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)