UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XiYHRwnOsKTbnTtCjFC9dEPORQC22f8NlIAVygHOccE=' 
WHERE 
  key_id = '1d8abc29900f8aa9d426209fd2c3c0c41bf28871ec518fc5dbbbb7cd7597053f' 
  AND (
    token = 'XiYHRwnOsKTbnTtCjFC9dEPORQC22f8NlIAVygHOccE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046