UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jR65GII3KEAQtE4xSeSw/Aj5mnWw0wffxfg/BQ1A8X4='
WHERE
key_id = '087817fc3edae83cba54b939d0159e26655744670f643718c988aad0ef5b65cc'
AND (
token = 'jR65GII3KEAQtE4xSeSw/Aj5mnWw0wffxfg/BQ1A8X4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)