UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6PDwNOCQiieUWtsRgCBCWg8fMJWyyr5JBHf0sWKLlfU='
WHERE
key_id = 'dd017e5ef9b8a1bdbfdc8b9200068e869870700e39bb623b07744410743f2ce7'
AND (
token = '6PDwNOCQiieUWtsRgCBCWg8fMJWyyr5JBHf0sWKLlfU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)