UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pLWPG5GvFW6nszG6rAIx0tuRfWG9qL2PTQOpPqOJk6c='
WHERE
key_id = 'ebc01c256afbfe42ad1138849308d0f013a4e98469d6c99d85a719a42a231b17'
AND (
token = 'pLWPG5GvFW6nszG6rAIx0tuRfWG9qL2PTQOpPqOJk6c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)