UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6B7FjNIsgZMwCuufXjPAcwLYFCLtKCDrO08AG7yKVg='
WHERE
key_id = '166e1e7e7edd079699fc3c229f90034f975233cecdd9b3c36d3392ae8bda923a'
AND (
token = 'S6B7FjNIsgZMwCuufXjPAcwLYFCLtKCDrO08AG7yKVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)