UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yG4xjmNa+/X9HEUE7wvB/cHnHn3tHRq6PsX+NDNT60g='
WHERE
key_id = '8dfaafd005f48acaa1e95e4d2de53990ce9cc786fdddef6efc68dff6765ecbf5'
AND (
token = 'yG4xjmNa+/X9HEUE7wvB/cHnHn3tHRq6PsX+NDNT60g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)