UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5cg9bLBkgxpeJkPDcPYv7OIZYAbeuRxNb+Z5h3i8du4='
WHERE
key_id = 'e65c66bd3315ec0cff431bbc60f214fd5fd8368e0bbe8ae3236ac49127b0a9d4'
AND (
token = '5cg9bLBkgxpeJkPDcPYv7OIZYAbeuRxNb+Z5h3i8du4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)