UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sMVWtmvH0Zdgxy4t8jGMAyqhm5uKzqb5T5u7/GPdguM='
WHERE
key_id = 'a749469eac81857220be6a9ac7a99c9b03d819162aeec1fc77aabc7cd04c5e62'
AND (
token = 'sMVWtmvH0Zdgxy4t8jGMAyqhm5uKzqb5T5u7/GPdguM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)