UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HKD5jDGn10Y4gxVk04+oPMVDNfXQTXeHHYWQEStmp2s='
WHERE
key_id = 'a4d411e1f856ea7423c847f9149e29cfa8fe3454150fa51bca7bc836af9e24fa'
AND (
token = 'HKD5jDGn10Y4gxVk04+oPMVDNfXQTXeHHYWQEStmp2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)