UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zaiWJqqjh0NQ3peAJRq+ETnkj7Yq6Zkgw7Z9dVF1tcI='
WHERE
key_id = '5298fa04a349f9173280e8cd360459fa431cf5f5d6c80e5b81a2a68313354683'
AND (
token = 'zaiWJqqjh0NQ3peAJRq+ETnkj7Yq6Zkgw7Z9dVF1tcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)