UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wHNmw3AC0g1epwP0O7VtyBIZCandFL19JjJN4ohjyOI='
WHERE
key_id = '82e77f06ebf84867c250e7ee308780e695cad9ae2c9b15a1e31286622abaca7a'
AND (
token = 'wHNmw3AC0g1epwP0O7VtyBIZCandFL19JjJN4ohjyOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)