UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GpHBaOg9wWDTIQOQQ174c15SUr8XGWj5l5E9V4zoLdI='
WHERE
key_id = 'dd7507be0dde2eee93e863b78f040acead56e656e93b9f487cd0d2729efef0e6'
AND (
token = 'GpHBaOg9wWDTIQOQQ174c15SUr8XGWj5l5E9V4zoLdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)