UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3lOxbzMHngd5Y1D2BAOyPWhet47KawOHHDFIbXqHvEk='
WHERE
key_id = '8777be40a1d696c3f88d074a16282bb6a01399d7654ccdad61cff2875479a699'
AND (
token = '3lOxbzMHngd5Y1D2BAOyPWhet47KawOHHDFIbXqHvEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)