UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fHbN6qDzTWUVjLOzE3iMmYSmH/H9beB+21P46WL5SNg='
WHERE
key_id = 'c6629fe90d0b77cf56127d57e385ab77b21bd7de0befe32c0ae7a02bed937c47'
AND (
token = 'fHbN6qDzTWUVjLOzE3iMmYSmH/H9beB+21P46WL5SNg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)