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