UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1BnmOvZlgEu8RbWiPYdxHFkV5cJDfewESgo8T98eOQo='
WHERE
key_id = '97d067d94c66a417c298394f11df672a0e1edc110994023a749347c19738ac13'
AND (
token = '1BnmOvZlgEu8RbWiPYdxHFkV5cJDfewESgo8T98eOQo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)