UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JBsO/px121Q6TSZZz4kKtepmBZ5e0tuTXe7uU4t3f7Y='
WHERE
key_id = 'ed2048745c77c0d44b3030a0a1565f5b596f0115bbdbc43e09e591b0af09e704'
AND (
token = 'JBsO/px121Q6TSZZz4kKtepmBZ5e0tuTXe7uU4t3f7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)