UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3D41BEp3OE/Ir4ZMU4yC1o4ERlAejT6W3ueTlhEY+ZI='
WHERE
key_id = 'e778ba9c05a2cd987a650718cc260ac478a6a52dd0a77b7af5fe687dc8a07a61'
AND (
token = '3D41BEp3OE/Ir4ZMU4yC1o4ERlAejT6W3ueTlhEY+ZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)