UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't/YXH4XZFWdJp8LRMASOBCNT0lf7n7XRuVRS7MZigUs='
WHERE
key_id = '8f5805da5df254e9df7c4ad175db0c3ac8190aebe379ca87a47b64dc1079ea4f'
AND (
token = 't/YXH4XZFWdJp8LRMASOBCNT0lf7n7XRuVRS7MZigUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)