UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0cp2nH5tbv09s6YDVW18sF1f+Bb3nI+mHq0g39S/vO8='
WHERE
key_id = 'e5c6ca8ab421a4e5623b4a5600026ad7f857bf2c50bc78c79d5582346ced087a'
AND (
token = '0cp2nH5tbv09s6YDVW18sF1f+Bb3nI+mHq0g39S/vO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)