UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kbHB7jmFpRyV2RBEBv84FBm6XUBL17kXSkUrAW1LXco='
WHERE
key_id = '008ac6adc85792e13684581e49c33c0867bb704c9ad7de8560df47a7f9e5afe3'
AND (
token = 'kbHB7jmFpRyV2RBEBv84FBm6XUBL17kXSkUrAW1LXco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)