UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b6abzA5QNfFq6qeE9U5CKD/YXFwNffdSOGhfr8g6boM='
WHERE
key_id = 'f8f27b3dd167b1b831dd80efd9041f5d755dabce14d246d662e55a5f55905c4e'
AND (
token = 'b6abzA5QNfFq6qeE9U5CKD/YXFwNffdSOGhfr8g6boM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)