UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AQ4oU0dTxjO+CRH3XRjJJoewu3KYDAovm3OZfYiK+2U='
WHERE
key_id = 'b5ef6efbe1e0c94cc241ab5a7de148ae29bc2273774a2c8315398ef12264974e'
AND (
token = 'AQ4oU0dTxjO+CRH3XRjJJoewu3KYDAovm3OZfYiK+2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)